package com.zkthink.ceres.promotion.controller;

import com.zkthink.ceres.promotion.dto.PromotionStatDTO;
import com.zkthink.ceres.promotion.dto.PromotionTenantStatDTO;
import com.zkthink.ceres.promotion.entity.PromotionStat;
import com.zkthink.ceres.promotion.service.PromotionStatService;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.zkthink.base.controller.SuperController;
import com.zkthink.base.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.zkthink.security.annotation.PreAuth;


/**
 * <p>
 * 前端控制器
 * 
 * </p>
 *
 * @author JustArgo
 * @date 2020-06-30
 */
@Slf4j
@Validated
@AllArgsConstructor
@RestController
@RequestMapping("/promotionStat")
@Api(value = "PromotionStat", tags = "")
public class PromotionStatController {

    private PromotionStatService promotionStatService;

    @ApiOperation("查询统计数据")
    @GetMapping("/detail/{promotionId}")
    public R<PromotionStatDTO> getPromotionStatDetail(@PathVariable Long promotionId){
        return promotionStatService.getPromotionStatDetail(promotionId);
    }

    @ApiOperation("分页查询活动下的店铺统计详情")
    @GetMapping("/findTenantStatDetail")
    public R<PromotionTenantStatDTO> findTenantStatDetail(@RequestParam("promotionId") Long promotionId,
                                                          @RequestParam("pageIndex") Integer pageIndex,
                                                          @RequestParam("pageSize")Integer pageSize){
        return promotionStatService.findTenantStatDetail(promotionId,pageIndex,pageSize);
    }

}
